/*
 * PlayersSyncronizer.cpp
 *
 *  Created on: Nov 16, 2011
 *      Author: gonzalo
 */

#include "PlayersSyncronizer.h"
#include "../common/Constantes.h"
#include "../common/DTOCliente.h"

PlayersSyncronizer::PlayersSyncronizer(ColaMensajesRecibirServer* mensajesServer) {
	this->mensajesServer = mensajesServer;
	this->running = true;
}

PlayersSyncronizer::~PlayersSyncronizer() {
}

void* PlayersSyncronizer::run(){

	while(running){
		this->mensajesServer->setMensaje(new DTOCliente(SERVER_OWN,SERVER_OWN,INFORM));
		sleep(SYNCRONIZE_SECONDS_SIGNAL);
	}

	this->mensajesServer->setMensaje(new DTOCliente(SERVER_OWN,SERVER_OWN,SERVER_SHUTDOWN));

	return NULL;
}


void PlayersSyncronizer::terminar(){
	this->running = false;
}
